package org.pumpkin;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Component;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;

@Component
public class DemoFilter extends ZuulFilter {

	@Override
	public Object run() throws ZuulException {
		RequestContext ctx = RequestContext.getCurrentContext();
		HttpServletRequest request = ctx.getRequest();
		String s = String.format("%s >>> %s", request.getMethod(), request.getRequestURL().toString());
		System.out.println("^^^^^^^^^^^^^^^"+s);
		return null;
	}

	@Override
	public boolean shouldFilter() {

		return true;
	}

	@Override
	public int filterOrder() {
		return  0;
	}

	@Override
	public String filterType() {
		return "pre"; //routing post error
	}

}
